<?php

namespace App\Http\Controllers\Mini\Estate;

use App\Http\Controllers\Controller;
use App\Services\NoticeService;
use App\Services\FleaBannerService;

class PublicController extends Controller
{

    protected $service;

    public function __construct(NoticeService $noticeService)
    {
        $this->service = $noticeService;
    }

    /**
     * Notes: 首页公告列表
     * User: lstink
     * Date: 2021/3/4
     * Time: 3:13 下午
     * @return array
     */
    public function newNotice(): array
    {
        $info = $this->service->getNewNotice();
        return $info['status'] ? $this->success($info['data']) : $this->error(['msg']);
    }

    public function noticeDetail($id): array
    {
        $info = $this->service->getNoticeDetail($id);
        return $info['status'] ? $this->success($info['data']) : $this->error(['msg']);
    }

    public function fleaBanner():array
    {
        $info = (new fleaBannerService)->getFealBannerList();
        return $info['status'] ? $this->success($info['data']) : $this->error(['msg']);
    }
}
